// copyright: Team JBS

var lgin = true;

window.onload = pageLoad;
window.onresize = fillPage;

function pageLoad() {
	fillPage();
	//alert("Logged in!");
	if (lgin) {
		// "Login" changes to "Log Out" upon logging in. INCOMPLETE
		document.getElementById("lg").innerHTML = "<li id=\"lg\"><a href=\"#\" >Log Out</a></li>";
	}
	
}

function fillPage() {
	// do vertical and horizontall fill of the page
	verticalFill();
	horizontalFill();
}

function verticalFill() {
	// calculate and properly fill vertical space
	var headerHeight = document.getElementById("header").offsetHeight;
	var footerHeight = document.getElementById("footer").offsetHeight;
	document.getElementById("menu").style.height = window.innerHeight - headerHeight - footerHeight + "px";
	document.getElementById("content").style.height = window.innerHeight - headerHeight - footerHeight + "px";
}

function horizontalFill() {
	// horizontal fill of the content area
	document.getElementById("wrapper").style.minWidth = window.innerWidth + "px";	
	
	var menuWidth = document.getElementById("menu").offsetWidth;
	var contentArea = document.getElementById("content");
	contentArea.style.width = window.innerWidth - menuWidth + "px";
	//contentArea.style.position = "absolute";
}
